<template>
    <div>
        <el-table :data="tableData" stripe style="width: 100%" ref="multipleTableRef"
            @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55" />
            <el-table-column prop="name" label="姓名" />
            <el-table-column prop="tx" label="头像">
                <template #default="scope">
                    <img :src="scope.row.tx" alt="">
                </template>
            </el-table-column>
            <el-table-column prop="time" label="日期" />
            <el-table-column prop="region" label="愿望" />

            <el-table-column label="Operations">
      <template #default="scope">
        <el-button size="small" @click="handleEdit(scope.$index, scope.row)"
          >删除</el-button
        >
      </template>
    </el-table-column>
        </el-table>
    </div>
    <div class="pa">
        <el-button type="primary" @click="kp">批量删除</el-button>
    </div>
</template>

<script setup>
import { ref, reactive,computed } from 'vue'
import { useStore } from 'vuex';



const tableData=computed(()=>{
    return store.state.list
})

const store = useStore()
const Data = reactive({
    multipleTableRef: []
})
const kp = () => {
    store.commit('ads',Data.multipleTableRef)
}

const handleSelectionChange = (i) => {
    Data.multipleTableRef = i
}

const handleEdit=(a,b)=>{
    store.commit('del',a)
}
</script>

<style lang="scss" scoped>
.pa {
    margin-top: 20px;
}
img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}
</style>